package com.zaaach.citypickerdemo;

import com.zaaach.citypicker.CityPicker;
import com.zaaach.citypicker.model.HotCity;
import com.zaaach.citypicker.model.LocatedCity;
import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;

import static org.junit.Assert.*;

public class ExampleOhosTest {
    private  CityPicker cityPicker;
    @Test
    public void testBundleName() {
        final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName();
        assertEquals("com.zaaach.citypickerdemo", actualBundleName);
    }

    @Before
    public void set(){
        cityPicker = CityPicker.getInstance();
        LocatedCity locatedCity = new LocatedCity("深圳", "广东", "101280601");
        cityPicker.enableAnimation(true);
        cityPicker.setLocatedCity(locatedCity);
        ArrayList<HotCity> hotCities = new ArrayList<>();
        hotCities.add(new HotCity("北京", "北京", "101010100"));
        cityPicker.setHotCities(hotCities);
    }

    @Test
    public void isEnableAnim() {
        assertTrue(cityPicker.isEnableAnim());
    }

    @Test
    public void getmLocation() {
        assertEquals("深圳",cityPicker.getmLocation().getName());
    }

    @Test
    public void getmHotCities() {
        assertEquals("北京",cityPicker.getmHotCities().get(0).getName());
    }
}